/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ahmed
 */
@Entity
@Table(name = "FOURNISSEUR")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fournisseur.findAll", query = "SELECT f FROM Fournisseur f"),
    @NamedQuery(name = "Fournisseur.findByIdF", query = "SELECT f FROM Fournisseur f WHERE f.idF = :idF"),
    @NamedQuery(name = "Fournisseur.findByNomf", query = "SELECT f FROM Fournisseur f WHERE f.nomf = :nomf"),
    @NamedQuery(name = "Fournisseur.findByWeb", query = "SELECT f FROM Fournisseur f WHERE f.web = :web"),
    @NamedQuery(name = "Fournisseur.findByAdress", query = "SELECT f FROM Fournisseur f WHERE f.adress = :adress"),
    @NamedQuery(name = "Fournisseur.findByNumf", query = "SELECT f FROM Fournisseur f WHERE f.numf = :numf")})
public class Fournisseur implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID_F")
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idF;
    @Basic(optional = false)
    @Column(name = "NOMF")
    private String nomf;
    @Column(name = "WEB")
    private String web;
    @Basic(optional = false)
    @Column(name = "ADRESS")
    private String adress;
    @Basic(optional = false)
    @Column(name = "NUMF")
    private BigDecimal numf;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fournisseur")
    private Collection<Commander> commanderCollection;

    public Fournisseur() {
    }

    public Fournisseur(BigDecimal idF) {
        this.idF = idF;
    }

    public Fournisseur(BigDecimal idF, String nomf, String adress, BigDecimal numf) {
        this.idF = idF;
        this.nomf = nomf;
        this.adress = adress;
        this.numf = numf;
    }

    public BigDecimal getIdF() {
        return idF;
    }

    public void setIdF(BigDecimal idF) {
        this.idF = idF;
    }

    public String getNomf() {
        return nomf;
    }

    public void setNomf(String nomf) {
        this.nomf = nomf;
    }

    public String getWeb() {
        return web;
    }

    public void setWeb(String web) {
        this.web = web;
    }

    public String getAdress() {
        return adress;
    }

    public void setAdress(String adress) {
        this.adress = adress;
    }

    public BigDecimal getNumf() {
        return numf;
    }

    public void setNumf(BigDecimal numf) {
        this.numf = numf;
    }

    @XmlTransient
    public Collection<Commander> getCommanderCollection() {
        return commanderCollection;
    }

    public void setCommanderCollection(Collection<Commander> commanderCollection) {
        this.commanderCollection = commanderCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idF != null ? idF.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fournisseur)) {
            return false;
        }
        Fournisseur other = (Fournisseur) object;
        if ((this.idF == null && other.idF != null) || (this.idF != null && !this.idF.equals(other.idF))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MODEL.Fournisseur[ idF=" + idF + " ]";
    }
    
}
